﻿using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace Jet.Dal.Exceptions
{
	/// <summary>
	/// Exception thrown when the expected behavior is that SaveChanges for an entity would result in a database update 
	/// but in fact no rows in the database were affected. 
	/// This usually indicates that the database has been concurrently updated and a concurrency token that was expected 
	/// to match did not actually match. 
	/// State entries referenced by this exception are not serialized due to security and access to the state 
	/// entries after serialization will return null.
	/// </summary>
	[Serializable]
	[ComVisible(true)]
	[ClassInterface(ClassInterfaceType.None)]
	public class DataUpdateConcurrencyException : DataUpdateException
	{
		/// <summary>
		/// Initializes a new instance of the DataUpdateConcurrencyException class.
		/// </summary> 
		public DataUpdateConcurrencyException()
		{

		}

		/// <summary>
		/// Initializes a new instance of the DataUpdateConcurrencyException class with a specified error message.
		/// </summary>
		public DataUpdateConcurrencyException(string message)
			: base(message)
		{

		}

		/// <summary>
		/// Initializes a new instance of the DataUpdateConcurrencyException class with a specified error message and a reference to the inner exception that is the cause of this exception.
		/// </summary>
		public DataUpdateConcurrencyException(string message, Exception innerException)
			: base(message, innerException)
		{

		}

		/// <summary>
		/// Initializes a new instance of the DataLayerException class with serialized data.
		/// </summary>
		protected DataUpdateConcurrencyException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{

		}
	}
}
